/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thinkinginjava.svn.io.inputs;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 *
 * @author public_enemy
 */
public class BetterRead {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(SimpleRead.input);
        System.out.println("What is your name?");
        String name = stdin.nextLine();
        System.out.println(name);
        System.out.println(
                "How old are you? What is your favorite double?");
        System.out.println("(input: <age> <double>)");
        int age = stdin.nextInt();
        double favorite = 0;
        try {
            String fav = stdin.next();
            favorite = Double.parseDouble(fav);
        } catch (InputMismatchException ime) {
            System.out.print("Exception:");
            String nextS = stdin.next();
            System.out.println(nextS);
        }
        System.out.println(age);
        System.out.println(favorite);
        /*System.out.format("In 5 years you will be %d.\n",
        age + 5);
        System.out.format("My favorite double is %f.",
        favorite / 2);*/

    }
}
